unit FillValueLocate;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TEMPLETFORM, HemisphereButton, ComCtrls, StdCtrls, ExtCtrls,
  Menus, ToolWin, ModalForm, MoveImageButton, LabelButton;

type
  TFillValueLocateForm = class(TMyModalForm)
    rg: TRadioGroup;
    rb1: TGroupBox;
    Edit1: TEdit;
    rb3: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    dtpStart: TDateTimePicker;
    dtpEnd: TDateTimePicker;
    procedure rgClick(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure MIBtnOKClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FillValueLocateForm: TFillValueLocateForm;

implementation

uses data;

{$R *.dfm}

procedure TFillValueLocateForm.rgClick(Sender: TObject);
begin
  inherited;
  rb3.Visible :=rg.ItemIndex=1;
end;

procedure TFillValueLocateForm.Edit1KeyPress(Sender: TObject;
  var Key: Char);
begin
  inherited;
  if Key=#13 then
    MIBtnOKClick(MIBtnOK);
end;

procedure TFillValueLocateForm.MIBtnOKClick(Sender: TObject);
var
  strWhere:string;
begin
  inherited;
  case rg.ItemIndex of
  0:    strWhere:='Where stuNo='+''''+trim(Edit1.Text)+'''';
  1:    strWhere:='Where fillDate between #'+DateToStr(dtpStart.Date)
          +'# and #'+DateToStr(dtpEnd.Date)+'#';
  2:    strWhere:='Where orderlyMan='+''''+Trim(Edit1.Text)+'''';
  end;
  with DM.ADOQFillValue do
  begin
    Active:=false;
    SQL.Strings[1]:=strWhere;
    Active:=true;
    ModalResult:=mrOK;
  end;
end;

end.
